<?php
global $mosConfig_live_site;

$ei_admin = DIR_FS_ADMIN;
// ei_template_dir to change
//$ei_template_dir = DIR_WS_MODULES . EMAIL_INVOICE_DIR . INVOICE_TEMPLATE_DIR ;
$ei_template_dir = DIR_FS_HTTP_ROOT . 'components/com_ecjc_lang/templates/' . E_TEMPLATE_FOLDER . '/emailinvoice/';
$ei_image_dir = $mosConfig_live_site .'/components/com_ecjc_lang/templates/' . E_TEMPLATE_FOLDER . '/emailinvoice/';
$ei_css_path = $mosConfig_live_site .'/components/com_ecjc_lang/templates/' . E_TEMPLATE_FOLDER . '/emailinvoice/';
$ei_template_file = $ei_template_dir . 'invoice.php';
$ei_temp_file = DIR_WS_MODULES . EMAIL_INVOICE_DIR . FILENAME_EMAIL_CACHE_FILE;

require($mosConfig_absolute_path . '/components/com_ecjc_lang/languages/admin/' . $language . "/" . FILENAME_ORDERS_INVOICE);

$currencies = new currencies();
$oID = $insert_id;
$orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");
$order = new order($oID);
$date = date('M d, Y');
	
ob_start();
require($ei_template_file);
//this can be done in one funciton call in PHP >= 4.3.0 but to keep it compatible, I use 2
$email_order = ob_get_contents();
ob_end_clean();
	$ei_search = array(	"\n" ,
					"\r"
				);
		

	$email_order = str_replace($ei_search, "", $email_order);
	$email_order = str_replace('src="images/', "src=\"$ei_image_dir", $email_order);
	list($order->customer['firstname'], $order->customer['lastname']) = explode(" ", $order->customer['name']);

?>
